<?php


namespace App\Http\Middleware;

use App\Http\Controllers\admin\model\AdminModel;
use Closure;

class CheckIp
{
    public function handle($request,Closure $next){
        $arr = [
            '127.0.0.0',
            '127.0.0.1',
            '119.123.42.95',
            '172.18.175.45',
            '123.98.125.74'
        ];
        $userId = $request->header('userId');
        if($userId){
            $admin = AdminModel::queryFirst(['id'=>$userId],['login_status']);
            if($admin['login_status']===2){
                return response()->json(['code'=>10200,'msg'=>'请重新登陆']);
            }
        }

        return $next($request);

    }
}